package com.aaa.three.service.impl;

import com.aaa.three.entity.Registered;
import com.aaa.three.mapper.RecordsMapper;
import com.aaa.three.pojo.domain.AdminOffice;
import com.aaa.three.pojo.query.RecordsQuery;
import com.aaa.three.result.AjaxResult;
import com.aaa.three.service.RecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @PACKAGE_NAME: com.aaa.three.service.impl
 * @NAME: RecordsServiceImpl
 * @USER: Tprairie
 * @DATE: 2022/1/13
 * @PROJECT_NAME: three
 */
@Service
public class RecordsServiceImpl implements RecordsService {
    @Autowired
    private RecordsMapper recordsMapper;

    @Override
    public AjaxResult getDepartment() {
        List<AdminOffice> officeList=recordsMapper.getDepartment();
        return AjaxResult.success(officeList);
    }

    @Override
    public AjaxResult allRecords(RecordsQuery recordsQuery) {
        List<Registered>  registeredList=recordsMapper.allRecords(recordsQuery);
        Integer  sum=recordsMapper.allSum(recordsQuery);
        HashMap<Object, Object> map = new HashMap<>();
        map.put("listData",registeredList);
        map.put("sum",sum);
        return AjaxResult.success(map);
    }

    @Override
    public AjaxResult getDetailedRecords(Registered registered) {
        Registered r=recordsMapper.getDetailedRecords(registered);
        return AjaxResult.success(r);
    }
}
